<?php  namespace Home\Model;
use Hdphp\Model\Model;
class Orders extends Model{
    protected $table = "orders";
        //验证
    protected $validate = array(
        array('consignee','required','收货人不能为空',3,3),
        array('address','required','收货地址不能为空',3,3),
        array('mobile','required','收货电话不能为空',3,3),
        array('mobile','phone','手机号输入不正确',3,3),
    );
        //自动完成
    protected $auto = array(
        array('time','time','function',3,3),
        array('number','number','method',3,3),
        array('status','state','method',3,3),
        array('total','total','method',3,3),
        array('user_uid','user_uid','method',3,3),
    );
        //用户ID
    public function user_uid(){
        return $_SESSION['uid'];
    }
        //总价
    public function total(){
        return $_SESSION['cart']['total'];
    }
         //货号
    public function number(){
        $number = Cart::getOrderId();
        return $number;
    }
         //状态
    public function state(){
        return '未付款';
    }
        //增加
    public function store(){
        if(!$this->create()) return false;
        $oid = $this->add();
        return $oid;
    }










}




?>